package com.doraro.platform.module.device.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.doraro.platform.common.beans.params.ValidateGroups;
import com.doraro.platform.module.device.model.entity.RepairAdvice;
import com.doraro.platform.module.device.model.enums.OrderStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class OrderVO {
    @ApiModelProperty(value = "维修单号")
    @TableId(type = IdType.UUID)
    private String id;

    @NotNull(message = "故障设备编号不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障设备编号")
    private String deviceId;
    @NotBlank(message = "故障设备不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障设备名称")
    private String name;
    @ApiModelProperty(value = "故障设备分类")
    @NotBlank(message = "故障设备分类不能为空", groups = ValidateGroups.Create.class)
    private String type;
    @NotBlank(message = "故障描述不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障描述")
    private String detail;
    @NotNull(message = "故障时间不能为空", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @PastOrPresent(message = "故障时间不能为未来的时间", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @ApiModelProperty(value = "故障时间", example = "2018-04-11")
    private LocalDate breakdownTime;
    @NotNull(message = "生产时间不能为空", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @PastOrPresent(message = "生产时间不能为未来的时间", groups = {ValidateGroups.Create.class, ValidateGroups.Update.class})
    @ApiModelProperty(value = "生产时间", example = "2017-04-11")
    private LocalDate productionTime;

    @ApiModelProperty(value = "分派维修工程师编号")
    private String engineerId;

    @ApiModelProperty(value = "分配处理员（设备管理人员id)")
    private Integer managerId;

    @ApiModelProperty(value = "申请人编号")
    private Integer createUserId;

    @ApiModelProperty(value = "分派时间")
    private LocalDateTime dispatchTime;

    @ApiModelProperty(value = "创建时间(报修时间)")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "完成时间")
    private LocalDateTime completeTime;


    @ApiModelProperty(value = "0-维修申请中 1-设备维修中 2-维修完成，请求确认中  3-维修完成")
    private OrderStatus orderStatus;

    /***
     * 工程师提出建议
     */
    private List<RepairAdvice> advice;
}
